﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CategoryEdit.aspx.cs" Inherits="Com.CMS263.Web.manage.ManagerCategory.CategoryEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript" language="javascript" src="../../js/jquery-1.4.2.min.js"></script>

    <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link href="../common/validator.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript" src="../../js/ui.core.js"></script>

    <link href="../themes/base/ui.all.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript" src="../../js/ui.datepicker.js"></script>

    <script language="javascript" type="text/javascript">       
        function Saves() {
            var flag = false;
            if ($("#CatDesc").val().length < 1) {
                $("#CatDescSpan").html("<span class=\"Tootip\">请输入描述！</span>");
            } else {
                $("#CatDescSpan").html("");
            }
            if ($("#CatName").val().length < 1) {
                $("#CatNameSpan").html("<span class=\"Tootip\">请输入类别名称！</span>");
            }
            else {
                $("#CatNameSpan").html("");
            }
            if ($("#MeasureUnit").val().length < 1) {
                $("#MeasureUnitSpan").html("<span class=\"Tootip\">请输入数量单位！</span>");
            }
            else {
                $("#MeasureUnitSpan").html("");
            }
            if ($("#KeyWord").val().length < 1) {
                $("#KeyWordSpan").html("<span class=\"Tootip\">请输入关键字！</span>");
            }
            else {
                $("#KeyWordSpan").html("");
            }
             if ($("#GoodsType").val() < 1) {
                $("#GoodsTypeSpan").html("<span class=\"Tootip\">请选择商品类型！</span>");
            }
             else {
              $("#GoodsTypeSpan").html("");
             }
             if ($("#CatName").val().length > 0 && $("#MeasureUnit").val().length > 0 && $("#KeyWord").val().length > 0 && $("#CatDesc").val().length > 0) {

                flag = true;
            }
            if (flag) {
                return flag;
            } else {
                alert("请填写完整！");
            }
        }
        function checkNum(obj) {
            var tempstr;
            //先把非数字的都替换掉，除了数字和.   
            tempstr = obj.value.replace(/[^\d]/g, "");
            obj.value = tempstr;
        }
        $(document).ready(function() {
            $("#ParentId option").each(function() {

                if ($(this).attr("value") == '<%=ca.ParentId %>') {
                    $(this).attr("selected", "selected");
                }

            })
            $("#GoodsType option").each(function() {
            if ($(this).attr("value") == '<%=protypeId %>') {
                    $(this).attr("selected", "true");
                }
            })
        })
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_1">
            <tr> 
            
                <td height="23" colspan="2" class="table_2">
                    更改产品类别
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    <input type="hidden" value="<%=ca.Id %>" id="Id" name="Id" />
                    类别：
                </td>
                <td class="tdside">
                    <select id="ParentId" name="ParentId">
                        <option value="0">父节点</option>
                        <%int j = 3;
                          foreach (Com.CMS263.PO.Category caP in catePrList)
                          {
                              if (caP.ParentId == 0)
                              {
                                  if (caP.Id!=ca.Id)
                                  {
                                      
                                  
                        %>
                        <option value="<%=caP.Id %>">
                            <%=caP.CatName%></option>
                       <%-- <%
                                
                            Com.CMS263.BLL.CategoryBLL cateBll = new Com.CMS263.BLL.CategoryBLL();
                            System.Collections.Generic.IList<Com.CMS263.PO.Category> cateList = new System.Collections.Generic.List<Com.CMS263.PO.Category>();
                            cateList = cateBll.FindByParentId(caP.Id);
                            if (cateList.Count > 0)
                            {
                                foreach (Com.CMS263.PO.Category item in cateList)
                                {
                                                                            
                        %>
                        <option value="<%=item.Id %>">
                            <%for (int i = 0; i < j; i++)
                              {
                                  Response.Write("&nbsp;");
                              }     %><%=item.CatName%></option>
                        <%
                            }
                            }
                                   
                                
                        
                        %>--%>
                        <%}
                              }
                          }%>
                    </select>
                    
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    类别名称:
                </td>
                <td class="tdside">
                    <input id="CatName" value="<%=ca.CatName %>" type="text" name="CatName" /><span id="CatNameSpan"></span>
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    排序:
                </td>
                <td class="tdside">
                    <input id="SortOrder" value="<%=ca.SortOrder %> " type="text" name="SortOrder" onkeyup="checkNum(this);"
                        onblur="checkNum(this);" />
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    数量单位:
                </td>
                <td class="tdside">
                    <input id="MeasureUnit" value="<%=ca.MeasureUnit %> " type="text" name="MeasureUnit" /><span
                        id="MeasureUnitSpan"></span>
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    是否显示:
                </td>
                <td class="tdside">
                    <input id="yes" name="yes" type="checkbox" style="width: 20px" value="true" <%=Com.CMS263.Util.StringUtil.GetBool(ca.IsShow)?"checked":"" %> />是
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                    搜索关键字::
                </td>
                <td class="tdside">
                    <input id="KeyWord" value="<%=ca.KeyWord %>" type="text" name="KeyWord" /><span id="KeyWordSpan"></span>
                </td>
            </tr>
             <tr>
                <td class="tdleft">
                    商品类型:
                </td>
                <td class="tdside">
                     <select id="GoodsType" name="GoodsType"> 
                      <option value="0">请选择....</option>
                <%
                    foreach (Com.CMS263.PO.ProdType pa in typeList)
         {%>
                    <option value="<%=pa.Id%>"><%=pa.TypeName%></option>
                    <%} %>
                    </select>  
                    <span id="GoodsTypeSpan"></span>
                </td>
            </tr>           
            <tr>
                <td class="tdleft">
                    类别描述:
                </td>
                <td class="tdside">                   
                  <TEXTAREA NAME="CatDesc" id="CatDesc" ROWS="5" COLS="50"><%=ca.CatDesc %></TEXTAREA>

                    <span id="CatDescSpan"></span>
                </td>
            </tr>
            <tr>
                <td class="tdleft">
                </td>
                <td class="tdside">
                    <asp:Button ID="btnSave" runat="server" Text="保 存" OnClientClick="if(!Saves()){return false;}"
                        Width="70px" OnClick="btnSave_Click1" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="取消" id="cancel" onclick="history.go(-1)"  style="width:50px" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
